-
Notifications
You must be signed in to change notification settings - Fork 8
create space #540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create space #540
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds Privy authentication-based space creation functionality to the hypergraph-react package. It introduces two new hooks that allow users to create private and public spaces using Privy authentication instead of the existing createSpace method.
- Adds
usePrivyAuthCreatePrivateSpace
andusePrivyAuthCreatePublicSpace
hooks with comprehensive authentication and encryption handling - Updates the example app to use the new hooks with a space type selector UI
- Modifies the context to expose
syncServerUri
for private space creation
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
packages/hypergraph-react/src/index.ts | Exports the new Privy auth hooks with underscore prefixes |
packages/hypergraph-react/src/hooks/use-spaces.ts | Updates query key for public spaces to avoid conflicts |
packages/hypergraph-react/src/hooks/use-privy-auth-create-public-space.ts | Implements public space creation with Privy auth |
packages/hypergraph-react/src/hooks/use-privy-auth-create-private-space.ts | Implements private space creation with encryption and Privy auth |
packages/hypergraph-react/src/HypergraphAppContext.tsx | Adds syncServerUri to context for private space creation |
apps/privy-login-example/src/routes/index.tsx | Integrates new hooks with UI for space creation |
.changeset/plain-eggs-joke.md | Documents the patch-level change |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
const createPrivateSpace = async ({ name }: CreatePrivateSpaceParams) => { | ||
const accountAddress = privyIdentity?.accountAddress; | ||
if (!accountAddress) { | ||
setIsLoading(false); |
Copilot
AI
Sep 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting isLoading
to false before throwing an error is incorrect. The loading state should remain true since the operation hasn't completed yet, and the error will be thrown to the caller.
Copilot uses AI. Check for mistakes.
const signaturePrivateKey = privyIdentity?.signaturePrivateKey; | ||
const signaturePublicKey = privyIdentity?.signaturePublicKey; | ||
if (!encryptionPrivateKey || !encryptionPublicKey || !signaturePrivateKey || !signaturePublicKey) { | ||
setIsLoading(false); |
Copilot
AI
Sep 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting isLoading
to false before throwing an error is incorrect. The loading state should remain true since the operation hasn't completed yet, and the error will be thrown to the caller.
Copilot uses AI. Check for mistakes.
} | ||
const privyIdentityToken = privyIdentity?.privyIdentityToken; | ||
if (!privyIdentityToken) { | ||
setIsLoading(false); |
Copilot
AI
Sep 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting isLoading
to false before throwing an error is incorrect. The loading state should remain true since the operation hasn't completed yet, and the error will be thrown to the caller.
Copilot uses AI. Check for mistakes.
const [spaceName, setSpaceName] = useState(''); | ||
const { createPrivateSpace, isLoading: isCreatingPrivateSpace } = usePrivyAuthCreatePrivateSpace(); | ||
const { createPublicSpace, isLoading: isCreatingPublicSpace } = usePrivyAuthCreatePublicSpace(); | ||
console.log({ isCreatingPrivateSpace, isCreatingPublicSpace }); |
Copilot
AI
Sep 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug console.log statement should be removed before merging to production.
console.log({ isCreatingPrivateSpace, isCreatingPublicSpace }); |
Copilot uses AI. Check for mistakes.
397ba44
to
dc9d51c
Compare
No description provided.